// Scale layers by comp size - version 1.0

// This script will scale all layers in the comp by the scale_factor, below.
// It rescales position and scale. This is particularly useful if you resize a
// comp, and want to scale all of your objects to fit its new dimensions.

//      LAYER                                               PROPERTY                     CHANNEL
//      ------                                              ----------                     --------
// 1: doesn't matter                               doesn't matter               doesn't matter
// 2: doesn't matter                               doesn't matter               doesn't matter

if (time() == start_time) {
	original_comp_dimensions = {320,240};   // change this to comp size before scaling
	new_comp_dimensions = {160,120};          // change this to comp size after scaling

	scale_factor = (new_comp_dimensions / original_comp_dimensions);
}

l = 1;
while (l <= num_layers) {       // loop over every layer

        value(l, position) = value(l, position) * scale_factor;
        value(l, scale) = value(l, scale) * scale_factor;

  l = l+1;
}
